package com.cyd.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

/**
 * @author keyer
 */
@Controller
public class HelloWorldController {

    @RequestMapping("/hello") // 映射地址
    public ModelAndView hello() {
        System.out.print("做之前servlet要做的事情");
        // 添加model，就是数据
        ModelAndView mv = new ModelAndView();

        mv.setViewName("show");
        return mv;
    }

    @RequestMapping("/exception") // 映射地址
    public ModelAndView exception(String name, String age) {

        ModelAndView mv = new ModelAndView();
        mv.addObject("name", name);
        mv.addObject("age", age);

        mv.setViewName("show");
        return mv;
    }

}
